package com.genexususa.eo.bing.data.wsSubclasses;

import com.genexususa.eo.bing.CampaignManagementServiceClasses.LocationTarget;
import com.genexususa.eo.bing.data.GxItemException;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class GxLocationTarget extends LocationTarget {
    public GxLocationTarget(Element element) throws IllegalArgumentException, GxItemException {
        /*if (element.getElementsByTagName("BusinessTarget").getLength() > 0 ) {
            this.setBusinessTarget(new GxBusinessTarget((Element) element.getElementsByTagName("BusinessTarget").item(0)));

        }
        */
        if (element.getElementsByTagName("CityTarget").getLength() > 0 ) {
            this.setCityTarget(new GxCityTarget((Element) element.getElementsByTagName("CityTarget").item(0)));
        }
        if (element.getElementsByTagName("CountryTarget").getLength() > 0 ) {
            this.setCountryTarget(new GxCountryTarget((Element) element.getElementsByTagName("CountryTarget").item(0)));
        }
        if (element.getElementsByTagName("HasPhysicalIntent").getLength() > 0 &&
            element.getElementsByTagName("HasPhysicalIntent").item(0).getChildNodes().getLength() > 0) {
            this.setHasPhysicalIntent(Boolean.valueOf(((Node) element.getElementsByTagName("HasPhysicalIntent").item(0).getChildNodes().item(0)).getNodeValue()));
        }
        if (element.getElementsByTagName("MetroAreaTarget").getLength() > 0 ) {
            this.setMetroAreaTarget(new GxMetroAreaTarget((Element) element.getElementsByTagName("MetroAreaTarget").item(0)));
        }
        if (element.getElementsByTagName("RadiusTarget").getLength() > 0 ) {
            this.setRadiusTarget(new GxRadiusTarget((Element)element.getElementsByTagName("RadiusTarget").item(0)));
        }
        if (element.getElementsByTagName("StateTarget").getLength() > 0 ) {
            this.setStateTarget(new GxStateTarget((Element) element.getElementsByTagName("StateTarget").item(0)));
        }
        /*
        if (element.getElementsByTagName("TargetAllLocations").getLength() > 0 &&
            element.getElementsByTagName("TargetAllLocations").item(0).getChildNodes().getLength() > 0) {
            this.setTargetAllLocations(Boolean.valueOf(((Node) element.getElementsByTagName("TargetAllLocations").item(0).getChildNodes().item(0)).getNodeValue()));
        }
        */
    }
}
